home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / bitblt / bitblt.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  10.3 KB  |  377 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "BitBlt Tester"
  4.    ClientHeight    =   5685
  5.    ClientLeft      =   810
  6.    ClientTop       =   1515
  7.    ClientWidth     =   9150
  8.    Height          =   6090
  9.    Icon            =   BITBLT.FRX:0000
  10.    Left            =   750
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   379
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   610
  15.    Top             =   1170
  16.    Width           =   9270
  17.    Begin ComboBox Combo1 
  18.       Height          =   288
  19.       Left            =   5520
  20.       Style           =   2  'Dropdown List
  21.       TabIndex        =   7
  22.       Top             =   360
  23.       Width           =   1932
  24.    End
  25.    Begin CommandButton Command3 
  26.       Caption         =   "EXECUTE BitBlt"
  27.       Height          =   492
  28.       Left            =   240
  29.       TabIndex        =   0
  30.       Top             =   2280
  31.       Width           =   3252
  32.    End
  33.    Begin CommandButton Command5 
  34.       Caption         =   "Hide"
  35.       Height          =   492
  36.       Left            =   2280
  37.       TabIndex        =   13
  38.       Top             =   960
  39.       Width           =   612
  40.    End
  41.    Begin CommandButton Command4 
  42.       Caption         =   "Draw Print Regions"
  43.       Height          =   492
  44.       Left            =   240
  45.       TabIndex        =   12
  46.       Top             =   960
  47.       Width           =   1932
  48.    End
  49.    Begin TextBox Text8 
  50.       Height          =   372
  51.       Left            =   4560
  52.       TabIndex        =   6
  53.       Text            =   "30"
  54.       Top             =   360
  55.       Width           =   612
  56.    End
  57.    Begin TextBox Text7 
  58.       Height          =   372
  59.       Left            =   3840
  60.       TabIndex        =   5
  61.       Text            =   "20"
  62.       Top             =   360
  63.       Width           =   612
  64.    End
  65.    Begin TextBox Text6 
  66.       Height          =   372
  67.       Left            =   2760
  68.       TabIndex        =   4
  69.       Text            =   "110"
  70.       Top             =   360
  71.       Width           =   612
  72.    End
  73.    Begin TextBox Text5 
  74.       Height          =   372
  75.       Left            =   2040
  76.       TabIndex        =   3
  77.       Text            =   "170"
  78.       Top             =   360
  79.       Width           =   612
  80.    End
  81.    Begin TextBox Text4 
  82.       Height          =   372
  83.       Left            =   960
  84.       TabIndex        =   2
  85.       Text            =   "10"
  86.       Top             =   360
  87.       Width           =   612
  88.    End
  89.    Begin TextBox Text3 
  90.       Height          =   372
  91.       Left            =   240
  92.       TabIndex        =   1
  93.       Text            =   "10"
  94.       Top             =   360
  95.       Width           =   612
  96.    End
  97.    Begin TextBox Text2 
  98.       Height          =   372
  99.       Left            =   6240
  100.       TabIndex        =   10
  101.       Text            =   "c:\windows\redbrick.bmp"
  102.       Top             =   3120
  103.       Width           =   2652
  104.    End
  105.    Begin TextBox Text1 
  106.       Height          =   372
  107.       Left            =   1320
  108.       TabIndex        =   8
  109.       Text            =   "c:\windows\leaves.bmp"
  110.       Top             =   3120
  111.       Width           =   2652
  112.    End
  113.    Begin CommandButton Command2 
  114.       Caption         =   "Loadpicture"
  115.       Height          =   372
  116.       Left            =   240
  117.       TabIndex        =   9
  118.       Top             =   3120
  119.       Width           =   1092
  120.    End
  121.    Begin CommandButton Command1 
  122.       Caption         =   "Loadpicture"
  123.       Height          =   372
  124.       Left            =   5160
  125.       TabIndex        =   11
  126.       Top             =   3120
  127.       Width           =   1092
  128.    End
  129.    Begin PictureBox Picture2 
  130.       Height          =   2052
  131.       Left            =   5160
  132.       ScaleHeight     =   135
  133.       ScaleMode       =   3  'Pixel
  134.       ScaleWidth      =   247
  135.       TabIndex        =   15
  136.       TabStop         =   0   'False
  137.       Top             =   3480
  138.       Width           =   3732
  139.    End
  140.    Begin PictureBox Picture1 
  141.       Height          =   2052
  142.       Left            =   240
  143.       ScaleHeight     =   135
  144.       ScaleMode       =   3  'Pixel
  145.       ScaleWidth      =   247
  146.       TabIndex        =   14
  147.       TabStop         =   0   'False
  148.       Top             =   3480
  149.       Width           =   3732
  150.    End
  151.    Begin Label Label8 
  152.       Caption         =   "Label8"
  153.       FontBold        =   0   'False
  154.       FontItalic      =   0   'False
  155.       FontName        =   "Courier"
  156.       FontSize        =   9.75
  157.       FontStrikethru  =   0   'False
  158.       FontUnderline   =   0   'False
  159.       Height          =   252
  160.       Left            =   240
  161.       TabIndex        =   23
  162.       Top             =   1920
  163.       Width           =   8652
  164.    End
  165.    Begin Label Label7 
  166.       Caption         =   "BitBlt Command"
  167.       Height          =   252
  168.       Left            =   240
  169.       TabIndex        =   22
  170.       Top             =   1680
  171.       Width           =   2772
  172.    End
  173.    Begin Label Label6 
  174.       Caption         =   "Destination"
  175.       Height          =   252
  176.       Left            =   5160
  177.       TabIndex        =   21
  178.       Top             =   2880
  179.       Width           =   1452
  180.    End
  181.    Begin Label Label1 
  182.       Caption         =   "Source"
  183.       Height          =   252
  184.       Left            =   240
  185.       TabIndex        =   20
  186.       Top             =   2880
  187.       Width           =   732
  188.    End
  189.    Begin Label Label5 
  190.       Caption         =   "Raster Operation"
  191.       Height          =   252
  192.       Left            =   5520
  193.       TabIndex        =   19
  194.       Top             =   120
  195.       Width           =   1932
  196.    End
  197.    Begin Label Label4 
  198.       Caption         =   "UpLeft of Source"
  199.       Height          =   252
  200.       Left            =   3840
  201.       TabIndex        =   18
  202.       Top             =   120
  203.       Width           =   1452
  204.    End
  205.    Begin Label Label3 
  206.       Caption         =   "Wid. && Ht. of Dest."
  207.       Height          =   252
  208.       Left            =   2040
  209.       TabIndex        =   17
  210.       Top             =   120
  211.       Width           =   1572
  212.    End
  213.    Begin Label Label2 
  214.       Caption         =   "UpLeft of Dest."
  215.       Height          =   252
  216.       Left            =   240
  217.       TabIndex        =   16
  218.       Top             =   120
  219.       Width           =   1332
  220.    End
  221. Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
  222. Const BLACKNESS = &H42
  223. Const DSTINVERT = &H550009
  224. Const MERGECOPY = &HC000CA
  225. Const MERGEPAINT = &HBB0226
  226. Const NOTSRCCOPY = &H330008
  227. Const NOTSRCERASE = &H1100A6
  228. Const PATCOPY = &HF00021
  229. Const PATINVERT = &H5A0049
  230. Const PATPAINT = &HFB0A09
  231. Const SRCAND = &H8800C6
  232. Const SRCCOPY = &HCC0020
  233. Const SRCERASE = &H440328
  234. Const SRCINVERT = &H660046
  235. Const SRCPAINT = &HEE086
  236. Const WHITENESS = &HFF0062
  237. Dim k As Long
  238. Sub Combo1_Change ()
  239. combos
  240. End Sub
  241. Sub Combo1_Click ()
  242. combos
  243. End Sub
  244. Sub combos ()
  245. Select Case combo1.ListIndex
  246. Case 0
  247.     k = BLACKNESS
  248. Case 1
  249.     k = DSTINVERT
  250. Case 2
  251.     k = MERGECOPY
  252. Case 3
  253.     k = MERGEPAINT
  254. Case 4
  255.     k = NOTSRCCOPY
  256. Case 5
  257.     k = NOTSRCERASE
  258. Case 6
  259.     k = PATCOPY
  260. Case 7
  261.     k = PATINVERT
  262. Case 8
  263.     k = PATPAINT
  264. Case 9
  265.     k = SRCAND
  266. Case 10
  267.     k = SRCCOPY
  268. Case 10
  269.     k = SRCERASE
  270. Case 12
  271.     k = SRCINVERT
  272. Case 13
  273.     k = SRCPAINT
  274. Case 14
  275.     k = WHITENESS
  276. End Select
  277. filllabel
  278. End Sub
  279. Sub Command1_Click ()
  280. picture2 = LoadPicture(text2)
  281. End Sub
  282. Sub Command2_Click ()
  283. picture1 = LoadPicture(text1)
  284. End Sub
  285. Sub Command3_Click ()
  286. command5_click
  287. i% = BitBlt(picture2.hDC, Val(text3), Val(text4), Val(text5), Val(text6), picture1.hDC, Val(text7), Val(text8), k)
  288. End Sub
  289. Sub Command4_Click ()
  290. command5_click
  291. picture1.DrawStyle = 0
  292. picture1.DrawWidth = 2
  293. picture1.Line (Val(text7), Val(text8))-(picture1.Width - 2, picture1.Height - 2), , B
  294. picture1.DrawWidth = 1
  295. 'picture1.Line (Val(text7) + Val(text5), Val(text8) + Val(text6))-(Val(text7) + Val(text5) + 5, Val(text8) + Val(text6) + 15)
  296. 'picture1.Line (Val(text7) + Val(text5), Val(text8) + Val(text6))-(Val(text7) + Val(text5) + 15, Val(text8) + Val(text6) + 5)
  297. 'picture1.Line (Val(text7) + Val(text5), Val(text8) + Val(text6))-(Val(text7) + Val(text5) + 20, Val(text8) + Val(text6) + 20)
  298. picture1.DrawStyle = 1
  299. picture1.Line (Val(text7), Val(text8))-(Val(text7) + Val(text5), Val(text8) + Val(text6)), , B
  300. picture2.DrawStyle = 0
  301. picture2.DrawWidth = 2
  302. picture2.Line (Val(text3), Val(text4))-(Val(text3) + Val(text5), (Val(text4) + Val(text6))), , B
  303. End Sub
  304. Sub command5_click ()
  305. picture1.Refresh
  306. picture2.Refresh
  307. End Sub
  308. Sub filllabel ()
  309. Label8.Caption = "i% = BitBlt(Picture2.hdc, " & Format$(Val(text3), "0") & ", " & Format$(Val(text4), "0") & ", " & Format$(Val(text5), "0") & ", " & Format$(Val(text6), "0") & ", Picture1.hdc, " & Format$(Val(text7), "0") & ", " & Format$(Val(text8), "0") & ", " & combo1.List(combo1.ListIndex) & ")"
  310. End Sub
  311. Sub Form_Load ()
  312. combo1.AddItem "BLACKNESS"
  313. combo1.AddItem "DSTINVERT"
  314. combo1.AddItem "MERGECOPY"
  315. combo1.AddItem "MERGEPAINT"
  316. combo1.AddItem "NOTSRCCOPY"
  317. combo1.AddItem "NOTSRCERASE"
  318. combo1.AddItem "PATCOPY"
  319. combo1.AddItem "PATINVERT"
  320. combo1.AddItem "PATPAINT"
  321. combo1.AddItem "SRCAND"
  322. combo1.AddItem "SRCCOPY"
  323. combo1.AddItem "SRCERASE"
  324. combo1.AddItem "SRCINVERT"
  325. combo1.AddItem "SRCPAINT"
  326. combo1.AddItem "WHITENESS"
  327. combo1.ListIndex = 10
  328. k = SRCCOPY
  329. filllabel
  330. End Sub
  331. Sub magicmarker (a As TextBox)
  332. a.SelStart = 0
  333. a.SelLength = Len(a)
  334. End Sub
  335. Sub Text1_GotFocus ()
  336. magicmarker text1
  337. End Sub
  338. Sub Text2_GotFocus ()
  339. magicmarker text2
  340. End Sub
  341. Sub Text3_Change ()
  342. filllabel
  343. End Sub
  344. Sub Text3_GotFocus ()
  345. magicmarker text3
  346. End Sub
  347. Sub Text4_Change ()
  348. filllabel
  349. End Sub
  350. Sub Text4_GotFocus ()
  351. magicmarker text4
  352. End Sub
  353. Sub Text5_Change ()
  354. filllabel
  355. End Sub
  356. Sub Text5_GotFocus ()
  357. magicmarker text5
  358. End Sub
  359. Sub Text6_Change ()
  360. filllabel
  361. End Sub
  362. Sub Text6_GotFocus ()
  363. magicmarker text6
  364. End Sub
  365. Sub Text7_Change ()
  366. filllabel
  367. End Sub
  368. Sub Text7_GotFocus ()
  369. magicmarker text7
  370. End Sub
  371. Sub Text8_Change ()
  372. filllabel
  373. End Sub
  374. Sub Text8_GotFocus ()
  375. magicmarker text8
  376. End Sub
  377.